using System;

using SharpWind.Tools;

namespace SharpWind.Input
{
	public class InputManager : IDisposable
	{
		private Mouse mouse = null;

		private Keyboard keyboard = null;

		internal InputManager()
		{
			Mouse = new Mouse();
			Keyboard = new Keyboard();
		}

		internal bool Initialize()
		{
			if( !Mouse.Initialize() )
			{
				return false;
			}

			if( !Keyboard.Initialize() )
			{
				return false;
			}

			return true;
		}

		internal void Update()
		{
			Mouse.Update();
			Keyboard.Update();
		}

		public void Dispose()
		{
			SafeDispose.Dispose( Keyboard );
			SafeDispose.Dispose( Mouse );
		}

		public Keyboard Keyboard
		{
			get
			{
				return this.keyboard;
			}
			private set
			{
				this.keyboard = value;
			}
		}

		public Mouse Mouse
		{
			get
			{
				return this.mouse;
			}
			private set
			{
				this.mouse = value;
			}
		}
	}
}